const mixinsModel = {
  model: {
    prop: 'passMode',
    event: 'handlePassUp'
  },
  props: {
    passMode: {
      type: Object,
      default: () => ({})
    }
  },
  watch: {
    formModel: {
      handler(_new, _old) {
        this._handlePassUp(_new)
      },
      deep: true
    },
    passMode: {
      handler(_new, _old) {
        this.formModel = _new
      },
      deep: true
    }
  },
  created() {
    this.formModel = { ...this.passMode }
  },
  methods: {
    _handlePassUp(v) {
      this.$emit('handlePassUp', v)
    }
  }
}

export default mixinsModel
